
const express = require("express");
const route = express.Router();
const advModel = require("../db/model/advModel")

const isLoginMiddle = require("../middleware/isLoginMiddle");
//更新广告获取数据 接口
route.get("/getUpdateData", isLoginMiddle, async (req, res) => {

  const { _id } = req.query;

  // console.log(_id);
  try {
    //去数据库查询当前id的数据
    const findResult = await advModel.findOne({ _id })
    //查询到的数据给前端
    // console.log(findResult);
    res.send({
      code: 10000,
      message: "更新数据去查询到的数据成功",
      data: findResult
    })
  } catch (e) {
    console.log("更新数据前查询到的数据失败" + e.message);
    res.send({
      code: 10001,
      message: "更新数据去查询到的数据成功" + e.message,
      data: null
    })


  }



})


module.exports = route;